<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p></p>
    <script>
        let loginList = [
            { userName: 'admin', password: 'admin321' },
            { userName: 'zhangsan', password: 'zs321' },
            { userName: 'lisi', password: 'ls321' },
            { userName: 'yyqx', password: 'yyqx321' }
        ]

        let userInfo = {
            token1: {
                city: '杭州',
                money: '1000w',
                sex: '女',
                userName: 'admin',
                password: 'admin321'
            },
            token2: {
                city: '北京',
                money: '1100w',
                sex: '女',
                userName: 'zhangsan',
                password: 'zs321'
            },
            token3: {
                city: '北京',
                money: '800w',
                sex: '男',
                userName: 'lisi',
                password: 'ls321'
            },
            token4: {
                city: '天津',
                money: '600w',
                sex: '男',
                userName: 'yyqx',
                password: 'yyqx321'
            }
        }

        // console.log(`s;${k in userInfo[token].city}`)


        // let sbc = { userName: Name, password: Passwords }

        console.log()





        function fu() {


            for (; ;) {
                let nav = ''
                let Name = prompt('请输入你的用户名')
                let Passwords = prompt('请输入你的用户密码')
                let token = 'token' + Math.floor(Math.random() * (4) + 1)

                let count = 2


                for (let i = 0; i < loginList.length; i++) {

                    if (Name === loginList[i].userName && loginList[i].password === Passwords) {


                        return alert(`登入成功 具体用户信息
                                      city :${userInfo[token].city}
                                      money :${userInfo[token].money}
                                      sex :${userInfo[token].sex}
                                      userName :${userInfo[token].userName}`)
                        
                    }

                }


                if (Name !== loginList.userName || loginList.password !== Passwords) {
                    let nav = prompt(`账号不存在
                    1. 注册 
                    2.直接退出`)
                    
                }

                FocusEvent.san(function(a,b){
                    return a.money - b.money
                })




                loginList.push({ userName: Name, password: Passwords })


                // break




                // alert('注册成功，返回登入')
                // if (count === 0) return alert('你已经没有机会了')
                // let count = 2



            }
        }
        fu()



    </script>
</body>

</html>